package com.long1008.controller;

import com.long1008.pojo.RespBean;
import com.long1008.service.EmpService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/employee")
public class EmployeeController {
    @Resource
    EmpService empService;

    @RequestMapping("/basic")
    public String basic() {
        return "basic";
    }

    @RequestMapping("/")
    public String  hello() {
        return "Hello";
    }

    /**
     * 重置数据库主键
     */
    @RequestMapping("/reset")
    public RespBean resetTableId() {
        if (empService.resetTableId(empService.getMaxEid()) == 0) {
            return RespBean.ok("重置成功!");
        }
        else {
            return RespBean.error("重置失败!");
        }
    }
}
